/*
 * @Author: Lu junwen
 * @Date: 2022-04-14 01:08:39
 * @LastEditors: Lu junwen
 * @LastEditTime: 2022-04-14 01:13:05
 * @FilePath: \vue-shop-app-customer\src\util\index.js
 */
export function copy(obj) {
  let newobj = null     // 接受拷贝的新对象
  if (typeof (obj) == 'object' && typeof (obj) !== null) {   // 判断是否是引用类型
    newobj = obj instanceof Array ? [] : {}               // 判断是数组还是对象
    for (var i in obj) {
      newobj[i] = copy(obj[i])                        // 判断下一级是否还是引用类型
    }
  } else {
    newobj = obj
  }
  return newobj
}